#include "base.h"

#define _UART1_ENABLE_
#define _UART2_ENABLE_
//#define _UART3_ENABLE_
//#define _UART4_ENABLE_
//#define _UART5_ENABLE_
//#define _UART6_ENABLE_

//#define _UART1_DMA_
//#define _UART2_DMA_
//#define _UART3_DMA_
//#define _UART4_DMA_
//#define _UART5_DMA_
//#define _UART6_DMA_

#define STA_STANY		0x00
#define STA_BUSY		0x01
#define STA_OVER		0x03
#define	STA_ERRO		0x04
#define	STA_END			0x05

typedef struct
{
    u8		RxSate;
    u16 	RxLen, DmaLen;
    char	*RxBuffer;
    void 	(*SendByte)(u8 Byte);
    void 	(*SendString)(char *iStr);
    void 	(*SendArray)(u8 *iPrt, u16 Len);
    void  (*ReciveReset)(void);
} USART_INFO_STRUCT;
typedef struct
{
    u16	Delay, DelayMax, Busy;
} USART_DELAY_STRUCT;

#ifdef _UART1_ENABLE_
//************************UART1********************************
#define USART1_RX_DATA_MAX	1024
extern USART_INFO_STRUCT U1S;
extern char	U1S_RX_BUFFER[USART1_RX_DATA_MAX + 1];
void USART1_InterruptCall(void);
#endif

#ifdef _UART2_ENABLE_
//************************UART2********************************
#define USART2_RX_DATA_MAX	1024
extern USART_INFO_STRUCT U2S;
extern char	U2S_RX_BUFFER[USART2_RX_DATA_MAX + 1];
void USART2_InterruptCall(void);
#endif

#ifdef _UART3_ENABLE_
//************************UART3********************************
#define USART3_RX_DATA_MAX	256
extern USART_INFO_STRUCT U3S;
extern char	U3S_RX_BUFFER[USART3_RX_DATA_MAX + 1];
void USART3_InterruptCall(void);
#endif

#ifdef _UART4_ENABLE_
//************************UART4********************************
#define USART4_RX_DATA_MAX	256
extern USART_INFO_STRUCT U4S;
extern char	U4S_RX_BUFFER[USART4_RX_DATA_MAX + 1];
void USART4_InterruptCall(void);
#endif

#ifdef _UART5_ENABLE_
//************************UART5********************************
#define USART5_RX_DATA_MAX	256
extern USART_INFO_STRUCT U5S;
extern u8	U5S_RX_BUFFER[USART5_RX_DATA_MAX + 1];
void USART5_InterruptCall(void);
void USART5_SendByte(u8 Byte);
#endif
#ifdef _UART6_ENABLE_
//************************UART6********************************
#define USART6_RX_DATA_MAX	1024
extern USART_INFO_STRUCT U6S;
extern u8	U6S_RX_BUFFER[USART6_RX_DATA_MAX + 1];
void USART6_InterruptCall(void);
void USART6_SendByte(u8 Byte);
#endif

void USER_UART_INIT(void);
void UART_CallBackTIM(void);
/******************* (C) COPYRIGHT 2018 CCM  **************END OF FILE*********************/


